<%--
  Created by IntelliJ IDEA.
  User: user
  Date: 11.05.12
  Time: 18:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="db.DBConnection" %>
<%@ page import="db.User" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="db.Account" %>
<%
    int user_id = -1;
    String secret1 = "";
    Cookie[] cookies = request.getCookies();

    for (Cookie cookie : cookies) {
        if (cookie.getName().equals("user_id")) {
            user_id = Integer.parseInt(cookie.getValue());
        } else if (cookie.getName().equals("secret")) {
            secret1 = cookie.getValue();
        }
    }
    DBConnection dbConnection = new DBConnection();
    if (!dbConnection.isCookieOk(user_id, secret1)) {
        String redirectURL = "../index.jsp";
        response.sendRedirect(redirectURL);
    }

    int num = dbConnection.doGetNumberOfUnreadMessages(user_id);
%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Close account</title>
    <link rel="stylesheet" type="text/css" href="style"/>
</head>
<body>
<div class="logout" style="text-align:right;"><a href="../logout.jsp">  Logout</a></div>
<div class="header"><img src="logo.jpg"></div>
<div class="layout">
    <div class="sidebar">
        <ul class="cssmenu">
            <li><a href="personal_info.jsp">Personal info</a></li>
            <li><b><a href="operations.jsp">Operations</a></b></li>
            <li><a href="messages.jsp">Messages<% if (num != 0) {%> <b> (<%=num%>)</b> <%}%></a></li>
        </ul>
    </div>
    <div class="content">
    </div>
</div>
</body>
</html>